package com.qf.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @author 千锋教育
 * @Company http://www.mobiletrain.org/
 * @Version 1.0
 */
@RestController
public class LoginController {

    @RequestMapping("/login")
    public String login(String username  , String password , String captcha, HttpSession session){
        if(!"zhangsan".equals(username)){
            return "error";
        }
        String captchaSession = (String) session.getAttribute("captcha");

        if(captcha != null && captcha.equalsIgnoreCase(captchaSession)){
            return "success";
        }
        return "error";
    }
}
